<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>HelloWorld</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>Computed option</h1>
    <hr>
    <div id="app">      
        <p>  {{newPrice}}</p>
        <ul>
            <li v-for="item in reversNew">
                {{ item.title }} - {{item.date}}
            </li>
        </ul>
    </div>
   
    <script type="text/javascript">
        var newsList = [
            {title : '滴滴外卖PK美团打车 谁更有戏?',date:'2018/03/19'},
            {title : '干掉拼多多！马云现身阿里总部遭“围攻”，为淘宝特价..',date:'2018/03/20'},
            {title : '【一线】阿里巴巴向Lazada增资20亿美元 进一',date:'2018/03/19'},
            {title : '滴滴出行再融100亿 外卖大战即将开启',date:'2018/03/18'}
        ];


        var app = new Vue({
            el:'#app',
            data:{
                price:100,
                newsList : newsList
            },
            computed:{
                newPrice:function(){
                    return this.price = '$' + this.price + '元';
                },
                reversNew:function(){
                    // return this.newsList.reverse();
                    return this.newsList.reverse();
                }
            }
        })
    </script>
</body>
</html>